package com.leoblog.test.util;

import com.leoblog.test.base.AbstractUTestBaseTestCase;
import com.leoblog.util.UrlUtil;

public class UTestUrlUtil extends AbstractUTestBaseTestCase {
	
	String context = "/leoblog";
	
	public void testRelativeUrl1()
	{		
		String url = "http://192.168.1.1:8080/leoblog/a.jsp";
		
		assertEquals("/a.jsp", UrlUtil.getRelativeURL(context, url));		
	}
	
	public void testRelativeUrl2()
	{		
		String url = "http://192.168.1.1:8080/leoblog/views/a.jsp";
		
		assertEquals("/views/a.jsp", UrlUtil.getRelativeURL(context, url));		
	}
	
	public void testRelativeUrl3()
	{		
		String url = "http://192.168.1.1:8080/leoblog/a.action";
		
		assertEquals("/a.action", UrlUtil.getRelativeURL(context, url));		
	}
	
	public void testRelativeUrl4()
	{		
		String url = "http://192.168.1.1:8080/leoblog/a.action?a=1";
		
		assertEquals("/a.action?a=1", UrlUtil.getRelativeURL(context, url));		
	}
	
	public void testRelativeUrl5()
	{		
		String url = "http://192.168.1.1:8080/leoblog/acton/a.action?a=1";
		
		assertEquals("/acton/a.action?a=1", UrlUtil.getRelativeURL(context, url));		
	}
	
	public void testRelativeUrl6()
	{		
		String url = "/leoblog/acton/a.action?a=1";
		
		assertEquals("/acton/a.action?a=1", UrlUtil.getRelativeURL(context, url));		
	}
	
	public void testRelativeUrl7()
	{		
		String url = "/acton/a.action?a=1";
		
		assertEquals("/acton/a.action?a=1", UrlUtil.getRelativeURL(context, url));		
	}
	
	public void testRelativeUrl8()
	{		
		String url = "http://192.168.1.1:8080/leoblog/acton/a.action?a=1";
		
		assertEquals("/leoblog/acton/a.action?a=1", UrlUtil.getRelativeURL("", url));		
	}
	
	public void testRelativeUrl9()
	{		
		String url = "http://192.168.1.1:8080/leoblog/acton/a.action?a=1";
		
		assertEquals("/leoblog/acton/a.action?a=1", UrlUtil.getRelativeURL(null, url));		
	}
}
